import request from "./request";
import qs from "qs";

//精品推荐接口
export const JingPinAPI = () => request.get("/products/recommend");

// 热门兑换
export const ReMenAPI = () => request.get("/products/hot");

// 短信验证
export const SendSMSAPI = (params) =>
  request.post("/sendSMS", qs.stringify(params));

// 手机号验证登录 /phoneRegin
export const PhoneReginAPI = (params) =>
  request.post("/phoneRegin", qs.stringify(params));

// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginAPI = (params) =>
  request.post(`/wechatUsers/PCLogin`, qs.stringify(params));

//手机绑定微信请求
export const BindPhoneAPI = (params) =>
  request.post(`/wechatUsers/binding`, qs.stringify(params));

// 请求用户信息  /shop/userProfiles
export const UserProfilesAPI = () => request.get("/shop/userProfiles");

//详情页 /product/125
export const GoodDetailsAPI = (id) => request.get(`/products/${id}`);

// 加入购物车
export const ShopCartsAddAPI = (params) =>
  request.post(`/shop/carts/add`, qs.stringify(params));

// 商品查询
export const GoodSearchAPI = (params) =>
  request.get("/products", {
    params,
  });
